
package com.example.a7822.myapplication.shopcart.view;
/*
import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.widget.Toolbar;
import android.view.Display;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;



import me.imid.swipebacklayout.lib.SwipeBackLayout;
import me.imid.swipebacklayout.lib.app.SwipeBackActivity;

*/
public class GoodDetailViewImpl implements  GoodDetailView{

    @Override
    public void showNewsDetialContent(String newsDetailContent) {

    }

    @Override
    public void showProgress() {

    }

    @Override
    public void hideProgress() {

    }
}
/*

public class GoodDetailViewImpl extends SwipeBackActivity implements GoodDetailView {

    private NewsBrief mNews;
    private WebView webview;
    private NewsDetailPresenter mNewsDetailPresenter;
    private ProgressBar mProgressBar;
    private SwipeBackLayout mSwipeBackLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.yt_activity_newsdetail);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        mProgressBar = (ProgressBar) findViewById(R.id.progress);
        //mTVNewsContent = (HtmlTextView) findViewById(R.id.htNewsContent);
        initWebView();
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });

        mSwipeBackLayout = getSwipeBackLayout();
        mSwipeBackLayout.setEdgeSize(ToolsUtil.getWidthInPx(this));
        mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT);

        //news json格式
        String data = getIntent().getStringExtra("news");
        //把json数据转化为实体类。
        mNews = NewsBrief.fromString(data);

        CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
        collapsingToolbar.setTitle(mNews.getTitle());

        ImageLoaderUtils.display(getApplicationContext(), (ImageView) findViewById(R.id.ivImage), mNews.getCover());

        mNewsDetailPresenter = new NewsDetailPresenterImpl(getApplication(), this);
        mNewsDetailPresenter.loadNewsDetail(mNews.getId());
    }

    @SuppressLint("NewApi")
    private void initWebView() {
        webview = (WebView) findViewById(R.id.htNewsContent);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                // Activities and WebViews measure progress with different scales.
                // The progress meter will automatically disappear when we reach 100%
                GoodDetailViewImpl.this.setProgress(progress * 1000);
            }
        });
        webview.setWebViewClient(new WebViewClient() {
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                Toast.makeText(view.getContext(), "Oh no! " + description, Toast.LENGTH_SHORT).show();
            }
        });
        webview.getSettings().setDefaultTextEncodingName("UTF-8");
        webview.setInitialScale(100);
        webview.getSettings().setSupportZoom(false);
        webview.getSettings().setBuiltInZoomControls(true);
        webview.getSettings().setLoadWithOverviewMode(true);
        webview.getSettings().setUseWideViewPort(true);
        // webview.getSettings().setJavaScriptEnabled(true);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
        } else {
            webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
        }
    }

    @Override
    public void showNewsDetialContent(String newsDetailContent) {
        //mTVNewsContent.setHtmlFromString(newsDetailContent, new HtmlTextView.RemoteImageGetter().LocalImageGetter());
        //mTVNewsContent.setHtmlFromString(newsDetailContent, new HtmlTextView.RemoteImageGetter());
        Display display = getWindowManager().getDefaultDisplay();
        newsDetailContent.indexOf("<p>");
        int width = display.getWidth();
        webview.loadDataWithBaseURL(null, "<style>img{display: inline;height:auto;width:" + width + ";max-width: 100%;" +
                "</style>" + formatNews(newsDetailContent), "text/html", "UTF-8", null);
    }

    private String formatNews(String content) {
        String insert = "<font size=\"7\">";
        String tag = "<p>";
        String temp;
        for (int i = 0; i < content.length(); i++) {
            if (i < content.length() - 2) {
                temp = content.substring(i,i+3);
                if (temp.equals(tag)) {
                    content = insertString(content, i + 3, insert);
                    i = i + 3;
                }
            }
        }
        return content;
    }

    private String insertString(String origin, int start, String insertContent) {
        return origin.substring(0, start) + insertContent + origin.substring(start);
    }

    @Override
    public void showProgress() {
        mProgressBar.setVisibility(View.VISIBLE);
    }

    @Override
    public void hideProgress() {
        mProgressBar.setVisibility(View.GONE);
    }
}
*/
